package com.pattern.bridge.no;

import junit.framework.Assert;

import org.junit.Test;

import com.pattern.bridge.Cup;
import com.pattern.bridge.CupMaker;
import com.pattern.bridge.no.BigGlassGrayCupMaker;
import com.pattern.bridge.no.BigGlassGreenCupMaker;
import com.pattern.bridge.no.BigGlassRedCupMaker;
import com.pattern.bridge.no.SmallGlassGrayCupMaker;
import com.pattern.bridge.no.SmallGlassGreenCupMaker;
import com.pattern.bridge.no.SmallGlassRedCupMaker;

public class CupMakerTest {
	@Test
	public void testBigGlassRedCupMaker() {
		CupMaker cupMaker = new BigGlassRedCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("big", "red", "glass", cup);
	}

	@Test
	public void testBigGlassGreenCupMaker() {
		CupMaker cupMaker = new BigGlassGreenCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("big", "green", "glass", cup);
	}

	@Test
	public void testBigGlassGrayCupMaker() {
		CupMaker cupMaker = new BigGlassGrayCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("big", "gray", "glass", cup);
	}
	@Test
	public void testSmallGlassRedCupMaker() {
		CupMaker cupMaker = new SmallGlassRedCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("small", "red", "glass", cup);
	}
	
	@Test
	public void testSmallGlassGreenCupMaker() {
		CupMaker cupMaker = new SmallGlassGreenCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("small", "green", "glass", cup);
	}
	
	@Test
	public void testSmallGlassGrayCupMaker() {
		CupMaker cupMaker = new SmallGlassGrayCupMaker();
		Cup cup = cupMaker.makeCup();
		assertCup("small", "gray", "glass", cup);
	}

	private void assertCup(String size, String color, String material, Cup cup) {
		Assert.assertEquals(material, cup.getMaterial());
		Assert.assertEquals(size, cup.getSize());
		Assert.assertEquals(color, cup.getColor());
	}
}
